//
//  growthPhotosView.m
//  SKaURobot
//
//  Created by cdong on 16/2/26.
//  Copyright © 2016年 cdong. All rights reserved.
//

#import "growthPhotosView.h"

@implementation growthPhotosView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setView];
    }
    return self;
}

- (void)loadNagavitionViewWithString:(NSString *)nameString{
    self.navigationV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375*matchW, 64)];
    self.navigationV.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_bg"]];
    [self addSubview:self.navigationV];
    
    self.navigationVL = [[UILabel alloc]initWithFrame:CGRectMake(((self.frame.size.width - 100)/2), 20, 100, 44)];
    self.navigationVL.text = nameString;
    self.navigationVL.textAlignment = NSTextAlignmentCenter;
    self.navigationVL.textColor = [RGBColorEncapsulation colorWithRGB:0xf8f8f8 alpha:1];
    self.navigationVL.font = [UIFont systemFontOfSize:19];
    [self.navigationV addSubview:self.navigationVL];
    
    self.backBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.backBtn.frame = CGRectMake(12*matchW, CGRectGetMinY(self.navigationVL.frame)+9, 25*matchW, 25*matchW);
    [self.backBtn setBackgroundImage:[UIImage imageNamed:@"iconfont_home"] forState:UIControlStateNormal];
    [self.navigationV addSubview:self.backBtn];
}

- (void)setView{
    self.backgroundColor = [UIColor whiteColor];
    [self loadNagavitionViewWithString:@"成长相册"];
    
    UIView *btnView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.navigationV.frame), self.frame.size.width, 44*matchH)];
    btnView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_subguide"]];
    [self addSubview:btnView];
    
    self.growthLeftBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.growthLeftBtn.frame = CGRectMake(0, CGRectGetMaxY(self.navigationV.frame), self.frame.size.width/2, 44*matchH);
    [self.growthLeftBtn setTitle:@"成长相册" forState:UIControlStateNormal];
    [self.growthLeftBtn setTitleColor:[RGBColorEncapsulation colorWithRGB:0xffffff alpha:1] forState:UIControlStateNormal];
    self.growthLeftBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    self.growthLeftBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.growthLeftBtn];
    
    self.growthRightBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.growthRightBtn.frame = CGRectMake(CGRectGetMaxX(self.growthLeftBtn.frame), CGRectGetMinY(self.growthLeftBtn.frame), self.frame.size.width/2, 44*matchH);
    [self.growthRightBtn setTitle:@"更多照片" forState:UIControlStateNormal];
    [self.growthRightBtn setTitleColor:[RGBColorEncapsulation colorWithRGB:0x7e7e7d alpha:1] forState:UIControlStateNormal];
    self.growthRightBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    self.growthRightBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.growthRightBtn];
    
    self.fillV = [[UIView alloc]initWithFrame:CGRectMake(0,  CGRectGetMaxY(self.growthLeftBtn.frame), self.frame.size.width/2, 3*matchH)];
    self.fillV.backgroundColor = [RGBColorEncapsulation colorWithRGB:0xcc222a alpha:1];
    [self addSubview:self.fillV];
    
    self.contentScrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.fillV.frame), self.frame.size.width, self.frame.size.height - CGRectGetMaxY(self.fillV.frame))];
    self.contentScrollV.contentSize =CGSizeMake(self.frame.size.width * 2, 0);
    self.contentScrollV.bounces = NO;
    [self addSubview:self.contentScrollV];
    
    self.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - CGRectGetMaxY(self.fillV.frame))];
//    self.leftView.backgroundColor = [UIColor redColor];
    [self.contentScrollV addSubview:self.leftView];
    
    self.rightView = [[UIView alloc]initWithFrame:CGRectMake(self.frame.size.width, 0, self.frame.size.width, self.frame.size.height - CGRectGetMaxY(self.fillV.frame))];
//    self.rightView.backgroundColor = [UIColor greenColor];
    [self.contentScrollV addSubview:self.rightView];
}
@end
